@include "sorter.awk"

BEGIN { main() }

function main(    s,pairs,m,n,i,freq) {
    s2a("adddress,50,age,25,height,12,legs,6,ears,3,yes,2,head,1",pairs)
    oo(pairs,"pairs")
    sorted(pairs,s)
    oo(s["best"],"sort")
    oo(s["cdf"],"cdf")
    seed(1)
    m=n=1000
    while(n--)
        freq[pick(s)]++
    for(i in freq) 
        freq[i] = round(100* freq[i]/m)
    o(freq,"freq")
}
